package net
{
	import flash3.net.MsgPacket;
	import flash3.net.NetFacade;
	public class CoreGroup extends MessageGroup
	{
		public static const MDM_KN_COMMAND:uint			= 	0;								//内核命令
		public static const SUB_KN_DETECT_SOCKET:uint		=	1;								//检测命令
		public static const SUB_KN_LOADTIME:uint			=	2;								//加载时间
		public static const SUB_KN_FAILED:uint			=	0xffff;							//发送失败
		public static var checkCount:uint = 0;
		
		public var isSend:Boolean = true;
			
		override public function defMessage():void
		{
			addMessage(new MessageDef(MDM_KN_COMMAND, SUB_KN_DETECT_SOCKET, "检测命令", onCoreDetectSocket));
			addMessage(new MessageDef(MDM_KN_COMMAND, SUB_KN_FAILED, "检测命令", onCoreSendFailed));
			addMessage(new MessageDef(MDM_KN_COMMAND, SUB_KN_LOADTIME, "加载时间", onLoadTime));
		}
		
		public function onCoreDetectSocket(packet:MsgPacket):void
		{
			checkCount++;
			if(isSend)
			{
				isSend = false;
				NetFacade.i.send(MDM_KN_COMMAND, SUB_KN_DETECT_SOCKET);
			}
			if(checkCount % 2 == 0)
			{
				isSend = true;
			}
		}
		public function onLoadTime(packet:MsgPacket):void
		{
			
		}
		public function onCoreSendFailed(packet:MsgPacket):void
		{
			
		}
	}
}